package com.futao.mapper;

import com.futao.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author futao
 * Created on 18-6-5-下午5:38.
 * 映射器类
 */
@Mapper
@Component
public interface UserMapper {

    @Select("SELECT * FROM futao_user WHERE NAME = #{name}")
    User findByName(@Param("name") String name);

    @Insert("INSERT INTO futao_user(id,NAME, AGE) VALUES(#{id}, #{name}, #{age})")
    void insert(@Param("id") Long id, @Param("name") String name, @Param("age") Integer age);

    @Select("select * from futao_user")
    List<User> list();
}
